package DAOHibernate;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;

import modelo.Cuestionario;

import DAO.CuestionarioDAO;

public class CuestionarioDAOhiberjpa implements CuestionarioDAO{

	private static EntityManagerFactory emf = Persistence
			.createEntityManagerFactory("base-ttps-final");

	@Override
	public void agregarCuestionario(Cuestionario cuestionario) {
		// TODO Auto-generated method stub
		try {
			EntityManager em = CuestionarioDAOhiberjpa.emf.createEntityManager();
			EntityTransaction etx = em.getTransaction();
			etx.begin();
			em.persist(cuestionario);
			em.flush();
			etx.commit();
			em.close();
		} catch (Exception e) {
			e.getMessage();
		}
	
	}

}
